package _01Xor;

import java.util.Scanner;

public class _02二进制中1的个数 {
    //思路： 创建输入N 计算 输出count
    public static void main(String[] args) {
        Scanner inputNum = new Scanner(System.in);
        int N =inputNum.nextInt();
        //将输入数据转化为二进制输出
        System.out.println(Integer.toString(N,2));

        int count = 0;
        //Solution 01
        for (int i = 0; i < 32; ++i) {
            if ((N&(1<<i)) == 1<<i) {
                count++;
            }
        }
        System.out.println("Solution 01 :"+count);
    //Solution 02
        count = 0;
        for(int i = 0; i < 32; ++i) {
            if (((N>>>i)&1) == 1) {
                count++;
            }
        }
        System.out.println("Solution 02 :"+count);
        //Solution 03
        count = 0;
        while (N != 0) {
            N = N&(N-1);
            count++;
        }
        System.out.println("Solution 03 :"+count);
    }
}
